var Currency = function(CNY){
    this.CNY = CNY;
};

Currency.prototype.roundTwoDecimals = function(amount){
    return Math.round(amount*100)/100;
}

Currency.prototype.CNYToUSD = function(cny){
    return this.roundTwoDecimals(cny*this.CNY);
};

Currency.prototype.USDToCNY = function(usd){
    return this.roundTwoDecimals(usd/this.CNY);
};

exports = Currency;
/*if only sets exports,the code won't work.
  if sets both exports and module.exports, the exports will be ignored. */

module.exports = Currency;
